package com.up4years.dataapi.service.system;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.up4years.dataapi.dao.system.UserMapper;
import com.up4years.utils.EncryptUtil;

@Service
public class UserService {
	@Autowired
	private UserMapper userMapper;
	
	public Map<String,Object> getByPhone(String phone,String passwd){
		passwd = EncryptUtil.MD5Encode(passwd).toLowerCase();
		return this.userMapper.getByPhone(phone, passwd);
	}
	public Map<String,Object> getByUserName(String userName,String passwd){
		passwd = EncryptUtil.MD5Encode(passwd).toLowerCase();
		return this.userMapper.getByUserName(userName, passwd);
	}
	public boolean existUserName(String username){
		return this.userMapper.existUserName(username)>0;
	}
	public boolean existPhone(String mobile){
		return this.userMapper.existPhone(mobile)>0;
	}
	public List<Map<String,Object>> list(Map<String,Object> parameters){
		return this.userMapper.list(parameters);
	}
}
